<template>
  <el-menu class="el-menu-demo" mode="horizontal" @select="handleSelect">
      <el-menu-item index="1">图书管理</el-menu-item>
      <el-menu-item index="2">分类管理</el-menu-item>
    </el-menu>
</template>

<script>

export default {
  name: "Header",
  methods: {
    // 路由跳转
    handleSelect(index) {
      switch (index) {
        case "1":
          if (this.$route.path !== '/Book') {
            this.$router.replace('/Book');
          }
          break;
        case "2" :
          if (this.$route.path !== '/BookType') {
            this.$router.replace('/BookType');
          }
          break;
        default :
          this.$router.replace('/404');
          break;
      }
    },
  }
}

</script>
